<template>

  <div>
    <div class="top0">
        <br> 
      <div class="top2" align=left>
        <div><br>
            &emsp;<img width="60px" src="https://img.zcool.cn/community/01a3865ab91314a8012062e3c38ff6.png@1280w_1l_2o_100sh.png" alt="">
        </div>
        <div><br>
            &emsp;<b>{{user_data.name}}</b> <br>
            <div v-if="user_data.id == 2">&emsp;<van-tag color="#ffe1e1" text-color="#ad0000">管理员</van-tag></div>

            &emsp;<font size=2>123账号：{{user_data.username}}</font> <br>
        </div>
      </div><br>
      <!--  -->
      <div>
        <div class="top3">
            <div class="top5" @click="news(1)">
                <div class="top6"></div>
                <div class="top4">
                    <div>新闻管理</div>
                    <div><van-icon name="arrow" /></div>
                </div>
                <hr color=eeeeee>
            </div>
            <!-- ========= -->

            <div class="top5" @click="news(2)">
                <div class="top6"></div>
                <div class="top4">
                    <div>积分记录</div>
                    <div><van-icon name="arrow" /></div>
                </div>
                <hr color=eeeeee>
            </div>
            <!-- ========= -->
        </div>
      </div>
      <!--  -->
      <div></div>
      <!--  -->
      <div></div>
      <!--  -->
      <div></div>
      <!--  -->
      <div></div>
      <!--  -->
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
        user_data: {},
        show: 0
    };
  },
  props: {},

  components: {},

  created() {},

  mounted() {
    this.userDataGet();
  },

  methods: {
    userDataGet(){
        this.axios.get('/user', {params: {user_id: localStorage.user_id}})
        .then(res =>{
            console.log('获取用户信息的响应:', res)
            this.user_data = res.data
        })
    },
    onChanges(res){
        console.log(res)
    },
    news(num){
        if (num == 1){
            this.$router.push('/news')
        } else if (num == 2){
            this.$router.push('/integral')
        }
    }
  },

  computed: {},

  watch: {},

  directives: {},

  filters: {},
};
</script>

<style scoped >
* {
  margin: 0;
}
.top6{
    height: 10px;
}
.top5{
    margin-left: 20px;
    margin-right: 20px;
}
.top4{
    display: flex;
    justify-content:space-between;
    margin-bottom: 10px;
}
.top0{
    background-color: rgb(45, 186, 230);
    height: 800px;
}
.top2{
    background-color: #fff;
    margin: 0 auto;
    border-radius: 20px;
    width: 95%;
    height: 100px;
    display: flex;
}
.top3{
    background-color: #fff;
    margin: 0 auto;
    border-radius: 15px;
    width: 95%;
}
</style>
